<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>药品添加</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
  <input type="hidden" id="id" name="id" value="${webItem.id}" />

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #ff0000;">*</span>药品名</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="name" name="name" value="${webItem.name}" placeholder="请输入药品名" lay-verify="required">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #ff0000;">*</span>零售价</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input name" id="money" name="money" value="${webItem.money}" placeholder="请输入零售价" lay-verify="required">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #ff0000;">*</span>类别</label>
    <div class="layui-input-block">
      <select class="form-control" name="type" id="type">
        <option <#if webItem.type=='1'>selected</#if>  value="1">疫苗接种</option>
        <option <#if webItem.type=='2'>selected</#if> value="2">基因检测</option>
        <option <#if webItem.type=='3'>selected</#if> value="3">医学美容</option>
        <option <#if webItem.type=='4'>selected</#if> value="4">其他医疗服务</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">药厂</label>
    <div class="layui-input-block">
      <input type="text" class="layui-input name" id="factory" name="factory" value="${webItem.factory}" placeholder="请输入药厂">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">地址</label>
    <div class="layui-input-block">
      <input type="text" class="layui-input name" id="address" name="address" value="${webItem.address}" placeholder="请输入地址" >
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #ff0000;">*</span>排序</label>
    <div class="layui-input-block">
      <input type="number" class="layui-input name" id="sort" name="sort" value="${webItem.sort}" placeholder="请输入排序" maxlength="30" lay-verify="required">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <div class="layui-input-block">
      <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="btnSubmit">确定</button>
      <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary closeLay">取消</button>
    </div>
  </div>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script src="${s.base}/js/base/jquery-3.2.0.min.js"></script>
<script type="text/javascript" src="${s.base}/js/base/ajaxfileupload.js"></script>
<script type="text/javascript">
    layui.use(['form','layer'],function(){
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;
        form.on("submit(btnSubmit)",function(data){
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            var field = data.field;
            var status = field.status;
            var type = field.type;

            // 实际使用时的提交信息
            $.post("/webItem/updateOrAddEntity",data.field,function(result){
                if(1==result.returnInfo.state){
                    top.layer.close(index);
                    top.layer.msg("操作成功！");
                    layer.closeAll("iframe");
                    //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.msg(result.returnInfo.errorMsg);
                }
            },"json")
            return false;
        });
    })
</script>

</body>
</html>